package IOStream.CopyFileDome;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * ClassName:Dome003
 * Package:IOStream.CopyFileDome
 * Description:
 *
 * @Author:ZhangXin
 * @Create2023/2/28-20:42
 * @Version:v1.0
 */
public class Dome003 {
    /**
     * 文件拷贝
     * 把E:\JianYing拷贝到E:\JianYing\aaa文件夹下
     */

    public static void main(String[] args) throws IOException {
        long start = System.currentTimeMillis();
        //创建对象
        FileInputStream fis = new FileInputStream("E:\\aaa\\a.txt");
        FileOutputStream fos = new FileOutputStream("E:\\aaa\\ccc\\copy.txt");
        //拷贝
        int len;
        byte[] bytes = new byte[1024 * 1024 * 5];//5兆大小的数组
        while ((len = fis.read()) != -1) {
            fos.write(bytes,0,len);
        }
        //释放资源
        fos.close();
        fis.close();
        long end = System.currentTimeMillis();
        System.out.println(end-start);
    }
}
